//
//  Util.m
//  InterventixApp
//
//  Created by Diego Falcinelli on 08/05/13.
//
//

#import "DateUtil.h"

@implementation DateUtil


+(long long) NSDateToLong:(NSDate *) nsdate{
    NSTimeInterval timeStamp = [nsdate timeIntervalSince1970];
    long long t = [[NSNumber numberWithDouble: timeStamp] doubleValue] * 1000;
    return t;
}
+(NSString *) NSDateToLongNSString:(NSDate *) nsdate{
    return [NSString stringWithFormat:@"%lld",[self NSDateToLong:nsdate]];
}

+(NSNumber *) NSDateToNSNumber:(NSDate *) nsdate{
    return [NSNumber numberWithLongLong:[self NSDateToLong:nsdate]];
}

+(NSDate *) LongToNSDate:(long long) longdate{
    long long d = 1000;
    return [NSDate dateWithTimeIntervalSince1970:(longdate/d)];
    
}
+(NSDate *) LongNSStringToNSDate:(NSString *) longdate{
    return [self LongToNSDate:[longdate longLongValue]];
}
@end
